package edi.manager;

import edi.dao.DocHistoryDao;
import edi.entities.DocHistoryEntity;
import edi.entities.DocumentEntity;
import edi.utils.DocumentUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author Kamilo
 */
@Service("documentService")
public class DocumentServiceImpl implements DocumentService {
    
    @Autowired
    DocHistoryDao docHistDao;
    
    @Override
    public void insertDocHistory(DocumentEntity ent, Long auditUsrId, String comment){
        
        DocHistoryEntity histEnt = DocumentUtil.createSnapshotHistory(ent, auditUsrId, comment);
        
        docHistDao.saveOrUpdate(histEnt);
        
    }

}
